package org.wy.controller;

import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.wy.feign.client.CommonFeign;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

/**
 * @name: GetDataTestController
 * @author: Zhang Jian
 * @date: 2024-01-09 10:31
 */
@Controller
@RequiredArgsConstructor
@Component
@CrossOrigin(origins = "*")
public class GetDataTestController {

    @Autowired
    private CommonFeign commonFeign;

//    @RequestMapping("jump2screen")
//    public void jump2screen(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        String dwbm = req.getParameter("dwbm");
//        System.err.println(dwbm);
//        Cookie cookie = new Cookie("dwbm",dwbm);
//        cookie.setMaxAge(60000);
//        cookie.setPath("/");
//        resp.addCookie(cookie);
//        req.getRequestDispatcher("dw-service-xxl-screen/index.html").forward(req,resp);
////        return "dw-service-xxl-screen/index.html";
//    }

//    @GetMapping("getDataTest")
//    public JSONObject geta() {
//        System.err.println("====================================数据接口调用===================================");
////        return commonFeign.getSstdlb("0120212150171", "");
//        return commonFeign.getSstdlb("0120212", "");
//    }

//    /**
//     * 测试多数据源连接
//     *
//     * @return
//     */
//    @GetMapping("getDataDifbase")
//    public String gettwobase() {
//        String qshydlsql = "SELECT * FROM test LIMIT 1";
//        Map<String, Object> qshydltMap = pwdpResultService.queryInfoBySql2(qshydlsql);
//        String qshydlsql1 = "SELECT * FROM test LIMIT 1";
//        Map<String, Object> qshydltMap1 = pwdpResultService.queryInfoBySql1(qshydlsql1);
//        return qshydltMap.toString();
//    }
}


